﻿using System.Net;
using UtilZ.Dotnet.Ex.Communication.Net.Base;

namespace UtilZ.Dotnet.Ex.Communication.Net.BMQ
{
    /// <summary>
    /// BMQ发布者配置
    /// </summary>
    public class BMQPublisherConfig
    {
        /// <summary>
        /// 通信协议，默认uudp
        /// </summary>
        public NetProtocols Protocol { get; set; } = NetProtocols.Udp;

        /// <summary>
        /// Tcp协议时为tcp监听EndPoint,udp协议时为本地绑定地址
        /// </summary>
        public EndPoint BindEndPoint { get; set; }

        /// <summary>
        /// 操作超时时长，单位：毫秒
        /// </summary>
        public int TimeoutMilliseconds { get; set; } = 1000;

        /// <summary>
        /// 心跳间隔时长，单位：毫秒
        /// </summary>
        public int HeartIntervalMilliseconds { get; set; } = 1000;

        /// <summary>
        /// Tcp半连接队列长度,当协议为udp时，此项无效
        /// </summary>
        public int Backlog { get; set; } = 10;

        /// <summary>
        /// 队列缓存最大数量
        /// </summary>
        public int CacheQueueMax { get; set; } = 10000;

        /// <summary>
        /// 加入到推送队列超时时长，单位：毫秒
        /// 仅当队列缓存最大数量大于0时有效
        /// </summary>
        public int PushTimeoutMilliseconds { get; set; } = 10000;

        /// <summary>
        /// 构造函数
        /// </summary>
        public BMQPublisherConfig()
            : base()
        {

        }
    }
}
